﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace RealEstateCenter
{
    public partial class SearchEstate : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                string query1 = "SELECT * FROM Estate WHERE estate_city = '" + estate_city.SelectedValue + "'";
                if (RoomNumber.SelectedValue != "Any")
                    query1 += " AND estate_room_number = '" + RoomNumber.SelectedValue + "'";
                if(!floor.Text.Equals(""))
                    query1 += " AND (estate_floor = '" + floor.Text + "')";
                query1 += " AND (estate_type ='" + Type.SelectedValue + "') AND (estate_heating_type like '%" + HeatingType.Text + "%')";
                SearchEstateSource.SelectCommand = query1;
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            
            GridView1.Visible = true;
        }
    }
}